import axios from "./request.js";
// let baseUrl='http://localhost:3000'
// 获取轮播图数据的api
// 0:pc 1:android 2:iphone 3:ipad
export function getBanner(type = 1) {
  return axios.get(`/banner?type=${type}`);
}
//推荐歌曲歌单,可选参数 ：limit：取出数量，默认为10
export function getMusic(limit = 10) {
  return axios.get(`/personalized?limit=${limit}`);
}
//获取歌单详情
export function getPlayListDetail(id, limit) {
  return axios.get(`/playlist/detail?id=${id}&limit=${limit}`);
}
//获取全部歌单歌曲
export function getAllPlayListMusic(id, limit) {
  return axios.get(`/playlist/track/all?id=${id}&limit=${limit}`);
}
//获取歌曲详情
export function getMusicDetail(ids) {
  return axios.get(`/song/detail?ids=${ids}`);
}

//获取歌词

export function getLyric(song) {
  if (song.lyric) {
    return;
  }
  const songId = song.id;
  return axios.get(`/lyric?id=${songId}`);
}
//搜索关键词
export function searchMusics(keyword, offset, showSinger, limit = 20) {
  return axios.get(
    `/cloudsearch?keywords=${keyword}&limit=${limit}&offset=${offset}`
  );
}
//热门搜索
export function getHotSearch() {
  return axios.get(`/search/hot`);
}
//搜索建议
export function searchAdvice(keyword) {
  return axios.get(`/search/suggest?keywords=${keyword}&type=mobile`);
}
//手机登录
export function phoneLogin(phone, password) {
  return axios.get(`/login/cellphone?phone=${phone}&password=${password}`);
}
//榜单查询
export function getTopList() {
  return axios.get(`/toplist/detail`);
}
//获取每日推荐歌曲
//说明 : 调用此接口 , 可获得历史日推可用日期列表
export function getEveryDayRecommend() {
  return axios.get(`/recommend/songs`);
}

//最新专辑
export function getNewestAlbum() {
  return axios.get(`/album/newest`);
}
//获取精品歌单 cat: tag, 比如 " 华语 "、" 古风 " 、" 欧美 "、" 流行 ", 默认为 "全部",
export function getGoodsPlayList(cat, limit) {
  return axios.get(`/top/playlist/highquality?cat=${cat}&limit=${limit}`);
}
/* 
获取热门歌手信息
limit : 返回数量默认为30,offset : 偏移数量，用于分页 ,
type 取值:-1:全部,1:男歌手,2:女歌手,3:乐队
area 取值:-1:全部,7华语,96欧美,8:日本,16韩国,0:其他
*/
export function getHotSinger(type = -1, area = -1, limit = 100) {
  return axios.get(`/artist/list?type=${type}&area=${area}&limit=${limit}`);
}
export function getSingerDetail(id) {
  return axios.get(`/artists?id=${id}`);
}
/* 
  获取歌曲的url
*/
export function getSingerUrl(id) {
  return axios.get(`/song/url=${id}`);
}
